package com.leoandroid.tool.toolsbox.largeread.fragment;

import android.content.Intent;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.RelativeLayout;

import androidx.fragment.app.Fragment;

import com.leoandroid.tool.toolsbox.AboutToolActivity;
import com.leoandroid.tool.toolsbox.PolicyToolActivity;
import com.leoandroid.tool.toolsbox.largeread.BuildConfig;
import com.leoandroid.tool.toolsbox.largeread.R;

public class MyFragment extends Fragment {

    public static final String policyUrl = BuildConfig.PRIVATE_URL;
    public static final String userUrl = BuildConfig.USER_URL;

    private View v;
    private RelativeLayout policyRl;
    private RelativeLayout userRl;
    private RelativeLayout aboutRl;

    public static MyFragment getInstance(){
        return new MyFragment();
    }

    @Override
    public void onResume() {
        super.onResume();

    }

    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container,
                             Bundle savedInstanceState) {
        v = inflater.inflate(R.layout.fragment_my, container, false);
        initview();
        return v;
    }

    public void initview(){
        policyRl = v.findViewById(R.id.mine_3);
        userRl = v.findViewById(R.id.mine_ggmm);
        aboutRl = v.findViewById(R.id.mine_gywm);
        policyRl.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                Intent it = new Intent(getActivity(), PolicyToolActivity.class);
                it.putExtra("TITLE","隐私政策");
                it.putExtra("CONTENT",policyUrl);
                getActivity().startActivity(it);
            }
        });

        userRl.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                Intent it = new Intent(getActivity(), PolicyToolActivity.class);
                it.putExtra("TITLE","用户协议");
                it.putExtra("CONTENT",userUrl);
                getActivity().startActivity(it);
            }
        });

        aboutRl.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                Intent it = new Intent(getActivity(), AboutToolActivity.class);
                getActivity().startActivity(it);
            }
        });
    }
}
